package dletc.Test;

import java.util.ArrayList;

public class Test01 {

	public static void main(String[] args) {
		//采用集合套集合  还可以创建2个类 把学生类作为班级类的属性 
		ArrayList<Student> oneClass = new ArrayList<Student>();
		
		oneClass.add(new Student("张三",20));
		
		oneClass.add(new Student("李四",30));
		
		ArrayList<Student> twoClass = new ArrayList<Student>();
		
		twoClass.add(new Student("二丫",20));
		
		twoClass.add(new Student("赵六",30));
		
		ArrayList<ArrayList<Student>> school = new ArrayList<ArrayList<Student>>();
		
		school.add(oneClass);
		school.add(twoClass);
		
		//遍历  因为是集合套集合 需要增强for嵌套
		for (ArrayList<Student> arrayList : school) {
			for (Student student : arrayList) {
				System.out.println(student);
			}
		}

	}

}
